<ui:composition template="/template/template-admin.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:define name="corpo">
        <h:form id="pa">
            <p:growl id="message" showDetail="true" life="5000"/>

            <div style="font-size: 13px !important; padding-bottom: 5% !important;">
                <!--                <p:panel id="oi" style="margin-bottom:10px; display: table-cell; vertical-align: middle; font-size: 13px !important; background-color: #90b4bd">-->

                <p:dataTable id="Professores" var="professor" value="#{gerenciaProfessorManagedBean.profes}" widgetVar="profesTable"
                             emptyMessage="Não há professores disponíveis" paginator="true" rows="10">

                    <p:column id="ativo" headerText="Ativo">
                        <h:outputText value="Sim" rendered="#{gerenciaProfessorManagedBean.isAtivo(professor)}"/>
                        <h:outputText value="Não" rendered="#{not gerenciaProfessorManagedBean.isAtivo(professor)}"/>
                    </p:column>

                    <p:column id="email" headerText="e-mail">
                        <h:outputText value="#{professor.email}"/>
                    </p:column>

                    <p:column id="nome" headerText="Nome">
                        <h:outputText value="#{professor.nome}"/>
                    </p:column>

                    <p:column id="sobrenome" headerText="Sobrenome">
                        <h:outputText value="#{professor.sobrenome}"/>
                    </p:column>

                    <p:column id="Seleção">
                        <p:commandButton icon="ui-icon-pencil" action="altera-professor">
                            <f:setPropertyActionListener value="#{professor}" target="#{gerenciaProfessorManagedBean.professor}" />
                        </p:commandButton>
                        <p:commandButton icon="ui-icon-trash" update="ativo" action="#{gerenciaProfessorManagedBean.remover(professor)}"
                                         rendered="#{gerenciaProfessorManagedBean.isAtivo(professor)}"/>
                    </p:column>

                </p:dataTable>

                <p:separator />
                <p:panel>
                    <p:commandButton value="Novo" action="../conteudo-admin/cadastrar-professor.xhtml?faces-redirect=true"/>
                    <!--<p:commandButton style="margin-bottom: 35px !important; margin-top: 20px !important;" value="Concluir" id="Submit"/>--> 
                </p:panel>
                <!--</p:panel>-->
            </div>

        </h:form>
    </ui:define>
</ui:composition>